<?php

namespace common\entities\outstock;

use common\entities\ContractEntity;
use Yii;

/**
 * This is the model class for table "myscrm_out_stock_order".
 *
 * @property string $id
 * @property string $order_code
 * @property integer $business_pattern
 * @property integer $contract_status
 * @property integer $money_status
 * @property integer $is_new_org
 * @property string $org_id
 * @property string $org_code
 * @property string $contract_id
 * @property string $contract_code
 * @property string $customer_id
 * @property string $customer_name
 * @property string $customer_full_name
 * @property string $customer_code
 * @property string $top_customer_name
 * @property string $sign_people_id
 * @property string $sign_amount
 * @property string $request_user_id
 * @property string $deliver_user_id
 * @property string $response_user_id
 * @property string $promise_fulfil_time
 * @property string $promise_fulfil_principle
 * @property string $remarks
 * @property integer $order_status
 * @property integer $flow_status
 * @property string $flow_step_id
 * @property string $created_on
 * @property string $modified_on
 * @property string $rent_start_date
 */
class MyscrmOutStockOrderEntity extends ContractEntity
{
    const FLOW_START = 1;
    const FLOW_TODO = 2;
    const FLOW_DONE = 3;

    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'myscrm_out_stock_order';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['id', 'order_code', 'customer_id', 'request_user_id', 'deliver_user_id', 'order_status'], 'required'],
            [['business_pattern', 'contract_status', 'money_status', 'is_new_org', 'order_status', 'flow_status'], 'integer'],
            [['sign_amount'], 'number'],
            [['promise_fulfil_time', 'created_on', 'modified_on', 'rent_start_date'], 'safe'],
            [['id', 'org_id', 'contract_id', 'customer_id', 'customer_code', 'request_user_id', 'deliver_user_id', 'response_user_id', 'promise_fulfil_principle', 'flow_step_id'], 'string', 'max' => 36],
            [['order_code', 'customer_full_name'], 'string', 'max' => 45],
            [['org_code', 'contract_code', 'customer_name', 'top_customer_name', 'sign_people_id'], 'string', 'max' => 50],
            [['remarks'], 'string', 'max' => 1024],
            [['order_code'], 'unique'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id'                       => 'ID',
            'order_code'               => '单据编号',
            'business_pattern'         => '1直属，2联营',
            'contract_status'          => '合同状态：1有，0没有',
            'money_status'             => '款项状态：1有，0没有',
            'is_new_org'               => '是否新租户1是，0否',
            'org_id'                   => '租户id',
            'org_code'                 => '租户CODE，不存在表示新租户',
            'contract_id'              => '关联合同ID',
            'contract_code'            => '关联合同号',
            'customer_id'              => '客户id',
            'customer_name'            => '客户名称',
            'customer_full_name'       => '客户全称',
            'customer_code'            => '客户code',
            'top_customer_name'        => '顶级客户名称',
            'sign_people_id'           => '合同签约人ID',
            'sign_amount'              => '签约金额',
            'request_user_id'          => '请求人员ID',
            'deliver_user_id'          => '交付人员ID',
            'response_user_id'         => '响应人员ID',
            'promise_fulfil_time'      => '兑现日期',
            'promise_fulfil_principle' => '兑现责任人ID',
            'remarks'                  => '备注',
            'order_status'             => '单据状态 1正常 0 删除',
            'flow_status'              => '流程状态 0未发起，10申请中，20已审批，21已确认，30已开通，31已授权',
            'flow_step_id'             => '当前流程步骤ID',
            'created_on'               => '创建时间',
            'modified_on'              => '修改时间',
            'rent_start_date'          => '租期开始日期',
        ];
    }
}
